<%@page contentType="text/html; charset=UTF-8" import="java.util.*"  language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getLocalName() + ":" + request.getLocalPort() + path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script type="text/javascript">
	var pageNo = $("#cpageNo").val();
	function selectPage(){
		var value = $("#selectPage").val();
		goPage(value)
	}
	$("#selectPage").val(pageNo);
	/**
	 * 查看采购单详情
	 * @param poid
	 */
	function showDetail(poid, tr) {
		var nextTr = $(tr).next("tr");
		if (nextTr.css("display") == "none") {
			nextTr.find("td").load("main/finance/pomainDetail", {"poid" : poid }, function() {
				
			});
		}
		nextTr.toggle();
	}
</script>


<table width="100%" border="0" align="center" cellspacing="1" class="c">
	<tr>
		<td class="title1">采购单编号</td>
		<td class="title1">创建时间</td>
		<td class="title1">供应商名称</td>
		<td class="title1">创建用户</td>
		<td class="title1">附加费用</td>
		<td class="title1">采购产品总价</td>
		<td class="title1">采购单总价格</td>
		<td class="title1">付款方式</td>
		<td class="title1">最低预付款金额</td>
		<td class="title1">处理状态</td>
		<td class="title1">操作</td>
	</tr>
	<c:forEach items="${page.dataList }" var="po">
		<tr ondblclick="showDetail(${po.poId},this)" title="双击查看详情">
			<td align="center">${po.poId }</td>
			<td align="center">${po.createTime }</td>
			<td align="center">${po.venderName}</td>
			<td align="center">${po.account}</td>
			<td align="center">${po.tipFee}</td>
			<td align="center">${po.poTotal}</td>
			<td align="center">${po.productTotal}</td>
			<td align="center">
				<c:if test="${po.payType == 1}">货到付款</c:if>
				<c:if test="${po.payType == 2}">款到发货</c:if>
				<c:if test="${po.payType == 3}">预付款到发货</c:if>
			</td>
			<td align="center">${po.prePayFee}</td>
			<td align="center">
				<c:if test="${po.status ==1 }">新增</c:if>
				<c:if test="${po.status ==2 }">已付款</c:if>
				<c:if test="${po.status ==3 }">已预付</c:if>
				<c:if test="${po.status ==4 }">已入库</c:if>
				<c:if test="${po.status ==5 }">已了结</c:if>
			</td>
			<td align="center">
			<a href="javascript:payment(${po.poId},
			<c:if test="${po.payType == 1 || po.payType== 2 || (po.payType == 3 && po.status == 3)}">1</c:if>
			<c:if test="${po.payType == 3 && po.status ==1}">2</c:if>)">
			
				<c:if test="${po.payType == 1 || po.payType==2}">付款登记</c:if>
				<c:if test="${po.payType == 3 && po.status ==1}">预付款登记</c:if>
				<c:if test="${po.payType == 3 && po.status ==3}">尾款登记</c:if>
			</a></td>
		</tr>
		<tr style="display:none">
			<td colspan="11" name="detail"></td>
		</tr>
	</c:forEach>
</table>

<!-- 导入分页层 -->
<%-- <%@include file="../../public/page.jsp"%> --%>
<div class="pageDiv">
	当前第<span id="currentPage">${page.currentPage}</span>页
	<c:if test="${page.currentPage == 1}">
		<input type="button" value="首页" disabled="disabled"/>
		
		<input type="button" value="上一页" disabled="disabled"/>
	</c:if>
	<c:if test="${page.currentPage != 1}">
		<input type="button" value="首页" onclick="goPage(1,${page.dataList[0].payType })"/>
		<input type="button" value="上一页" onclick="goPage(${page.currentPage-1},${page.dataList[0].payType })"/>
	</c:if>
	<c:if test="${page.currentPage == page.totalPage}">
		<input type="button" value="下一页" disabled="disabled"/>
		<input type="button" value="末页" disabled="disabled"/>
	</c:if>
	<c:if test="${page.currentPage != page.totalPage}">
		<input type="button" value="下一页" onclick="goPage(${page.currentPage+1},${page.dataList[0].payType })"/>
		<input type="button" value="末页" onclick="goPage(${page.totalPage},${page.dataList[0].payType })"/>
	</c:if>
	<input type="hidden" value="${page.currentPage }" id="cpageNo">
	<select id="selectPage" onchange="selectPage()">
		<c:forEach begin="1" end="${page.totalPage }" var="mypage">
			<option value="${mypage }" id="option">第${mypage }页</option>
		</c:forEach>
	</select>
	共${page.totalPage}页 ${page.totalSize }条记录
</div>

